Indicator catalog article aims to summarize and describe usage of indicators used in JForex API. For an overview of indicator usage from a strategy please refer to <a href="#Strategy_API:_Indicators">Indicators overview</a>.<br/><br/>We assume the following values for the indicator calls in the examples below:<br/><div class="dw_article_geshi_code"><span style="color: #003399;">Instrument</span> instrument <span style="color: #339933;">=</span> <span style="color: #003399;">Instrument</span>.<span style="color: #006633;">EURUSD</span><span style="color: #339933;">;</span><br />Period period <span style="color: #339933;">=</span> Period.<span style="color: #006633;">ONE_MIN</span><span style="color: #339933;">;</span><br />IBar prevBar <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//previous bar/candle</span><br /><span style="color: #000066; font-weight: bold;">int</span> candlesBefore <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">int</span> candleAfter <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">int</span> shift <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div><div class="dw_article_headers_list"><div class="dw_article_header_h1"><a href="#Indicator_catalog/Alligator"> Alligator </a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Average_Price">\tAverage Price\t</a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Beta">Beta</a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Bollinger_Bands"> Bollinger Bands </a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Butterworth"> Butterworth </a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/CHANNEL_UP"> CHANNEL_UP </a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Exponential_Moving_Average">Exponential Moving Average</a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Hilbert_Transform_-_Instantaneous_Trendline">Hilbert Transform - Instantaneous Trendline</a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Market_Facilitation_Index"> Market Facilitation Index </a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/MinMax"> MinMax </a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Standard_Deviation">\tStandard Deviation\t</a></div><div class="dw_article_header_h1"><a href="#Indicator_catalog/Stochastic">Stochastic</a></div></div><span id="Indicator_catalog/Alligator"><h1> Alligator </h1></span>Alligator indicator helps to determine the presence and absence of a trend as well as its direction.<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_1.jpg" border="0" /><br/>You can call the alligator indicator using a special method <i>alligator()</i> or the universal method <i>calculateIndicator()</i> declared in <i>IIndicators</i> interface: Assume that we have an instrument and a period variable already defined. We need to calculate Alligator values for a Jaw Time Period: 13, a Teeth Time Period: 8 and a Lips Time Period: 5 <br/><br/><ul><li>Calculate indicator values using a shift. A result is a double array which contains 3 double values (Alligator Jaw,  Alligator Teeth and Alligator Lips) for the last bar(<i>shift</i> =1):</li></ul><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> alligator <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">alligator</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span> , <span style="color: #cc66cc;">13</span>, <span style="color: #cc66cc;">8</span>, <span style="color: #cc66cc;">5</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div><ul><li>Calculate indicator values for a bar range between a candle before and a candle after parameters. Return result is array of array with Aligator values for each candle from the specified candle before a parameter:</li></ul><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> alligator <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">alligator</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span> , <span style="color: #cc66cc;">13</span>, <span style="color: #cc66cc;">8</span>, <span style="color: #cc66cc;">5</span>, Filter.<span style="color: #006633;">NO_FILTER</span>, candleBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div><ul><li>Calculate indicator values between the specified bar range. In this example value just previous bar values will be calculated:</li></ul><div class="dw_article_geshi_code">&nbsp;<span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> alligator <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">alligator</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span> , <span style="color: #cc66cc;">13</span>, <span style="color: #cc66cc;">8</span>, <span style="color: #cc66cc;">5</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>In these methods 5, 6 and 7 parameters mean:<br/>Jaw Time Period: 13<br/>Teeth Time Period: 8<br/>Lips Time Period: 5 <br/><ul><li>Calculate indicator values using the universal method and specifying a shift. Return result: an array of objects which contains double values :</li></ul><div class="dw_article_geshi_code">&nbsp;<span style="color: #000066; font-weight: bold;">int</span> shift <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />&nbsp;<span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> alligatorUniversal <span style="color: #339933;">=</span> &nbsp;indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;ALLIGATOR&quot;</span>, &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">13</span>, <span style="color: #cc66cc;">8</span>, <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#125;</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp;</div><b>All these 4 methods return same alligator result for the last candle</b><br/>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><span id="Indicator_catalog/Average_Price"><h1>\tAverage Price\t</h1></span>The Average Price indicator shows an average bar price.<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_2.jpg" border="0" /><br/>Below is an example how to get the previous bar average price value using 3 special <i>avgPrice</i> methods and one universal calculateIndicator method:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span> avgPrice <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">avgPrice</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, &nbsp;shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span> avgPrice <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">avgPrice</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, &nbsp;shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div><ul><li><i>shift</i> parameter defines candle shift, if it is set to 1 then we will get indicator value for the previous candle. The returned result is the previous bar average double value.</li></ul><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> avgPrice <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">avgPrice</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, &nbsp;prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>Parameters number 4 and 5 prevBar.getTime() describe bars' time range where indicator values will be found. The returned result is double array with one element, because time range is limited to a single bar (namely, the previous bar).<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> avgPrice <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">avgPrice</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, &nbsp;Filter.<span style="color: #006633;">NO_FILTER</span>, candlesBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div><i>candlesBefore</i> defines the candle starting from which the indicator value will be calculated<br/><i>prevBar.getTime()</i> defines the candle's start time from which <i>candleBefore</i> and <i>candleAfter</i> parameters will be shifted<br/><i>candleAfter</i> defines candle count after the specified bar for which indicator value will be calculated.<br/><b>Example1.</b> <i>candlesBefore</i> = 2; <i>candleAfter</i> = 1; time is set in parameter #6 for last closed bar. The average value will be calculated for current, previous and next-to-last candles:<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_3.jpg" border="0" /><b>Example2.</b> <i>candlesBefore</i> = 2; <i>candleAfter</i> = 1; time is set in parameter #6 for next-to-last bar. The average value will be calculated for previous, second before current and third before current candles:<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_4.jpg" border="0" /><br/><div class="dw_article_geshi_code">&nbsp;<span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> avgPriceUniversal <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;AVGPRICE&quot;</span>, &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div><ul><li>The example above calculates the indicator values using universal method and specifying the shift. The returned result: array of objects which contains one double value.</li><li>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.</li></ul><br/>Indicator preview on the chart:<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_5.jpg" border="0" /><br/>Initializing necessary variables:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">int</span> fasterMaTimePeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br />MaType fasterMaType <span style="color: #339933;">=</span> MaType.<span style="color: #006633;">SMA</span> <span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">int</span> slowerMaTimePeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">34</span><span style="color: #339933;">;</span><br />MaType slowerMaType <span style="color: #339933;">=</span> MaType.<span style="color: #006633;">SMA</span><span style="color: #339933;">;</span></div>Let's give examples how to get a previous bar awesome values using 3 special <i>awesome</i> methods and one universal <i>calculateIndicator</i> method.<br/><br/>To get awesome indicator values for previous candle specifying shift equals to 1. Return result are  array of double containing 3 values.<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> awesome <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">awesome</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, appliedPrice, fasterMaTimePeriod,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fasterMaType, slowerMaTimePeriod, slowerMaType, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>To get awesome indicator values for previous candle specifying previous bar start time as time range. Return result are  array of double arrays containing 3 values.<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> awesome <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">awesome</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, appliedPrice, fasterMaTimePeriod, &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fasterMaType, slowerMaTimePeriod, slowerMaType, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>To get awesome values for 2 previous bars from and to bar time must be changed and then passed to the  <i>awesome</i> method: <br/><div class="dw_article_geshi_code">IBar lastBar <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_MIN</span>, OfferSide.<span style="color: #006633;">BID</span>,<span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />IBar nextToLastBar <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_MIN</span>, OfferSide.<span style="color: #006633;">BID</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> awesome <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">awesome</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, appliedPrice, fasterMaTimePeriod, &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fasterMaType, slowerMaTimePeriod, slowerMaType, nextToLastBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, lastBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>To get awesome indicator values for previous candle specifying  bar start time<i> prevBar.getTime()</i> and candle count before this bar <i>candlesBefore </i> and after <i>candleAfter</i>:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> awesome <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">awesome</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, appliedPrice, fasterMaTimePeriod, fasterMaType, slowerMaTimePeriod, slowerMaType, &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Filter.<span style="color: #006633;">NO_FILTER</span>, candlesBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>And last example shows how to get last bar awesome indicator values using universal method:<br/><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> awesomeUniversal <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;AWESOME&quot;</span>, &nbsp;<span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <br />&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>fasterMaTimePeriod, MaType.<span style="color: #006633;">SMA</span>.<span style="color: #006633;">ordinal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, slowerMaTimePeriod, MaType.<span style="color: #006633;">SMA</span>.<span style="color: #006633;">ordinal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><br/><span id="Indicator_catalog/Beta"><h1>Beta</h1></span>Shows discrepancy between specified prices<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_6.jpg" border="0" /><br/>First we need to initialize necessary fields (time period, two prices and two applied price):<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">int</span> timePeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br />OfferSide side1 <span style="color: #339933;">=</span> OfferSide.<span style="color: #006633;">BID</span><span style="color: #339933;">;</span><br />OfferSide side2 <span style="color: #339933;">=</span> OfferSide.<span style="color: #006633;">BID</span><span style="color: #339933;">;</span><br />AppliedPrice appliedPrice1 <span style="color: #339933;">=</span> AppliedPrice.<span style="color: #006633;">OPEN</span><span style="color: #339933;">;</span><br />AppliedPrice appliedPrice2 <span style="color: #339933;">=</span> AppliedPrice.<span style="color: #006633;">CLOSE</span><span style="color: #339933;">;</span></div>To get beta indicator value for previous candle specifying shift:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span> &nbsp; beta <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">beta</span><span style="color: #009900;">&#40;</span>instrument, period, side1, appliedPrice1, side2, appliedPrice2, timePeriod, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div>The example above returns double beta indicator value. <br/><br/>To get beta indicator value for previous candle specifying previous bar start time as time range: <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> beta <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">beta</span><span style="color: #009900;">&#40;</span>instrument, period, side1, appliedPrice1, side2, appliedPrice2, timePeriod, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div>The example above returns array of double containing 1 value.<br/><br/>To get beta indicator value for previous candle specifying bar start time prevBar.getTime() and candle count before this bar candlesBefore and after candleAfter:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> beta <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">beta</span><span style="color: #009900;">&#40;</span>instrument, period, side1, appliedPrice1, side2, appliedPrice2, timePeriod, Filter.<span style="color: #006633;">NO_FILTER</span>, candlesBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div>The example above returns array of double containing 1 value.<br/><br/>And last example shows how to get last bar beta indicator values using universal method: <br/><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> betaUniversal <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>side1, side2<span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;BETA&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>appliedPrice1, appliedPrice2<span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>timePeriod<span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><br/><span id="Indicator_catalog/Bollinger_Bands"><h1> Bollinger Bands </h1></span> <br/>This indicator displays whether the market is quiet or whether the market is loud. When the market is quiet, the bands squeeze; and when the market is loud, the bands expand. <br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_7.jpg" border="0" /><br/>Let's give examples how to get a previous bar awesome values using 3 special bband methods and one universal calculateIndicator method. <br/>First we need to initialize necessary fields:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">int</span> timePeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br />MaType maType <span style="color: #339933;">=</span> MaType.<span style="color: #006633;">EMA</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">double</span> nbDevDn <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">double</span> nbDevUp <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span></div>To get bollinger bands indicator values for previous candle specifying shift equals to 1. Return result are array of double containing 3 values. <br/><div class="dw_article_geshi_code">&nbsp;<span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> bbands <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">bbands</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, appliedPrice, timePeriod, nbDevUp, nbDevDn, maType, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div>To get bollinger bands  indicator values for previous candle specifying previous bar start time as time range. Return result are array of double arrays containing 3 values:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> bbands <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">bbands</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, appliedPrice,timePeriod, nbDevUp,nbDevDn, maType, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> </div>To get bollinger bands indicator values for previous candle specifying bar start time prevBar.getTime() and candle count before this bar candlesBefore and after candleAfter. Return result are array of double arrays containing 3 values. <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> bbands <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">bbands</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, appliedPrice, timePeriod,nbDevUp, nbDevDn, maType, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Filter.<span style="color: #006633;">NO_FILTER</span>, candlesBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>And last example shows how to get last bar bollinger bands indicator values using universal method: <br/><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> bbandsUniversal <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;BBANDS&quot;</span>, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>timePeriod, nbDevUp, nbDevDn, MaType.<span style="color: #006633;">EMA</span>.<span style="color: #006633;">ordinal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>All above bollinger bands methods result array contains following values sequence: <br/><ul><li>0 - Upper Band</li><li>1 - Middle Band</li><li>2 - Lower Band</li></ul>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><br/><span id="Indicator_catalog/Butterworth"><h1> Butterworth </h1></span> <br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_8.jpg" border="0" /><br/>First we need to initialize time period:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">int</span> timePeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">34</span><span style="color: #339933;">;</span></div>To get butterworth filter value for previous candle specifying shift:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span> butterworth <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">butterworthFilter</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, timePeriod, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns double value.<br/><br/>To get butterworth filter value for previous candle using time range:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> butterworth <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">butterworthFilter</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, timePeriod, lastBarTime, lastBarTime<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns double array containing 1 value.<br/><br/>To get butterworth filter value for previous candle specifying bar start time prevBar.getTime() and candle count before this bar <i>candlesBefore</i> and after <i>candleAfter</i>:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> butterworth <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">butterworthFilter</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, timePeriod, Filter.<span style="color: #006633;">NO_FILTER</span>, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; candlesBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns double array containing 1 value.<br/><br/>The last example shows how to get last bar  butterworth filter value using universal method<br/><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> butterworthUniversal <span style="color: #339933;">=</span> &nbsp;indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;BUTTERWORTH&quot;</span>, &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>timePeriod<span style="color: #009900;">&#125;</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /></div>The example above returns array of object containing 1 double value.<br/><br/>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><span id="Indicator_catalog/CHANNEL_UP"><h1> CHANNEL_UP </h1></span> <br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_9.jpg" border="0" /><br/>Channel Up indicator is the pattern indicator, and it can be called only by using a <i>calculateIndicator</i> method in the API. Let's create a channel up indicator usage example<br/><br/> First, we need to initialize necessary variables:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">int</span> x1 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Start Count of Bars on Sides </span><br /><span style="color: #000066; font-weight: bold;">int</span> x2 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Bars on Sides Increment Count</span><br /><span style="color: #000066; font-weight: bold;">double</span> x3 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Centering Inaccuracy</span><br /><span style="color: #000066; font-weight: bold;">double</span> x4 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Equality Inaccuracy </span><br />Period period <span style="color: #339933;">=</span> Period.<span style="color: #006633;">FIVE_MINS</span><span style="color: #339933;">;</span><br />Instrumentinstrument <span style="color: #339933;">=</span> <span style="color: #003399;">Instrument</span>.<span style="color: #006633;">EURUSD</span><span style="color: #339933;">;</span><br /></div> The method below  returns abstract indicator outputs for previous 2,000 bars (we pass the start time of 2,000 bar and start time of the last bar to the <i>calculateIndicator</i>  method). We use such big range, because channel up indicator rarely appears on the chart. This indicator provides 3 outputs: <br/><ul><li>prices for the upper asymptote,</li><li>prices for bottom asymptote,</li><li>and prices for the pattern indicator body line.</li></ul><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> channelOutputs &nbsp;<span style="color: #339933;">=</span> &nbsp;indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;CHANNEL_UP&quot;</span>, &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>x1, x2, x3, x4<span style="color: #009900;">&#125;</span>, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, <span style="color: #cc66cc;">2000</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>,<span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div> Cast each abstract indicator output to the object array:<br/><div class="dw_article_geshi_code"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> channelOutputs.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>channelOutputs <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> channelOutput <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>channelOutputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div>  Then, it is necessary to cast object to the PatternIndicatorOutput instance which contains pattern objects:<br/><div class="dw_article_geshi_code">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> object <span style="color: #339933;">:</span> channelOutput<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PatternIndicatorOutput output <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>PatternIndicatorOutput<span style="color: #009900;">&#41;</span>object<span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List<span style="color: #339933;">&lt;</span>PatternObject<span style="color: #339933;">&gt;</span> patterObjects <span style="color: #339933;">=</span> output.<span style="color: #006633;">getPatternObjects</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div> Last step is to iterate through pattern objects and display them.  Pattern objects are stored in the <i>IndexValue</i> collection: <br/><div class="dw_article_geshi_code">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>patterObjects <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>PatternObject patterObject <span style="color: #339933;">:</span> patterObjects<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>patterObject.<span style="color: #006633;">getPattern</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>IndexValue indexValue <span style="color: #339933;">:</span> patterObject.<span style="color: #006633;">getPattern</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.<span style="color: #006633;">getOut</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>indexValue.<span style="color: #006633;">getIndex</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; &quot;</span> <span style="color: #339933;">+</span> indexValue.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br /><br /><span style="color: #009900;">&#125;</span></div>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><span id="Indicator_catalog/Exponential_Moving_Average"><h1>Exponential Moving Average</h1></span>Exponential Moving Average (EMA) is a type of <a href="http://en.wikipedia.org/wiki/Moving_average">Moving Average</a> indicator. The indicator smooths the price data to form a trend over a given time period. In comparison to Simple Moving Average, EMA gives priority to most recent data, therefore it reacts quicker to price changes.<br/><a href="https://www.dukascopy.com/wiki/https://www.dukascopy.com/wiki/files/EmaAtomicTests.java">EmaAtomicTests.java</a><br/><span id="Indicator_catalog/Hilbert_Transform_-_Instantaneous_Trendline"><h1>Hilbert Transform - Instantaneous Trendline</h1></span><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_10.jpg" border="0" /><br/>To get ht_trendline indicator values for previous candle specifying shift:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span> htTrend <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">ht_trendline</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns double value.<br/><br/>To get ht_trendline indicator value for previous candle using time range:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> htTrend <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">ht_trendline</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns array of double arrays containing 1 value<br/><br/>To get ht_trendline indicator value for previous candle specifying bar start time prevBar.getTime() and candle count before this bar <i>candlesBefore</i> and after <i>candleAfter</i>:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> htTrend <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">ht_trendline</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, Filter.<span style="color: #006633;">NO_FILTER</span>, &nbsp; candlesBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candleAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns array of double arrays containing 1 value<br/><br/>The last example shows how to get last bar ht_trendline indicator values using universal method:<br/><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> htTrendUniversal <span style="color: #339933;">=</span> &nbsp;indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;HT_TRENDLINE&quot;</span>, &nbsp;<br />&nbsp; <span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns array of object containing 1 double value.<br/><br/>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><span id="Indicator_catalog/Market_Facilitation_Index"><h1> Market Facilitation Index </h1></span> <br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_11.jpg" border="0" /><br/><span id="Indicator_catalog/MinMax"><h1> MinMax </h1></span> <br/>Indicator MINMAX calculates the lowest and the highest prices for the specified period respectively.<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_12.png" border="0" /><br/><br/>3 methods are provided for the MINMAX indicator by the IIndicators interface. The following example demonstrates the use of these methods.<br/><br/>Define instrument, period and shift:<br/><font size="2"><br/> <div class="dw_article_geshi_code"><span style="color: #003399;">Instrument</span> instrument <span style="color: #339933;">=</span> <span style="color: #003399;">Instrument</span>.<span style="color: #006633;">EURUSD</span><span style="color: #339933;">;</span><br />&nbsp;Period period <span style="color: #339933;">=</span> Period.<span style="color: #006633;">ONE_HOUR</span><span style="color: #339933;">;</span><br />&nbsp;<span style="color: #000066; font-weight: bold;">int</span> shift <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div></font><br/>Calculate indicator values for the previous bar:   \t<br/><font size="2"><br/> <div class="dw_article_geshi_code">&nbsp;<span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> minMax <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">minMax</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, <span style="color: #cc66cc;">5</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; </div></font><br/>Calculate indicator values for the specified range:   \t    \t<br/><font size="2"><br/> <div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">long</span> prevBarTime <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, shift<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />&nbsp;<span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> minMax <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">minMax</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, <span style="color: #cc66cc;">5</span>, prevBarTime, prevBarTime<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></font><br/>Calculate indicator values for the specified range using a filter:<br/><font size="2"><br/> <div class="dw_article_geshi_code">&nbsp;<span style="color: #000066; font-weight: bold;">int</span> candlesBefore <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>, candlesAfter <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />&nbsp;<span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> minMax <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">minMax</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, <span style="color: #cc66cc;">5</span>, Filter.<span style="color: #006633;">NO_FILTER</span>, candlesBefore, prevBarTime, candlesAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div></font><br/>Also, you can use universal methods to calculate the MINMAX indicator values:<br/><font size="2"><br/> <div class="dw_article_geshi_code">&nbsp;<span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> minMax <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">ASK</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;MINMAX&quot;</span>, &nbsp;<br />&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">new</span> AppliedPrice<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>IIndicators.<span style="color: #006633;">AppliedPrice</span>.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#125;</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></font><br/>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><br/><span id="Indicator_catalog/Standard_Deviation"><h1>\tStandard Deviation\t</h1></span>Indicator "stddev" calculates the standard deviation of specified prices.<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_13.png" border="0" /><br/>This indicator has two specific input parameters:<br/><ul><li><i>nbDev</i> - each output of stddev is multiplied by nbDev, this allows to stretch or squeeze the indicator output vertically.</li><li><i>timePeriod</i> - the number of candles used to compute stddev</li></ul><br/>To initialize the parameters:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">int</span> timePeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">double</span> nbDev <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></div>To get <i>stddev</i> indicator values for a candle specifying shift:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span> stddev <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stdDev</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, timePeriod, nbDev, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns standard deviation for a ask candle (specified by shift) calculated from previous candle close prices.<br/><br/>To get <i>stddev</i> indicator values for previous candle using time range: <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stddev <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stdDev</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, timePeriod, nbDev, askBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, askBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>To get <i>stddev</i> values for 2 previous bars, from and to bar time must be changed and then passed to the <i>stddev</i> method: <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">long</span> lastBarTime <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_MIN</span>, OfferSide.<span style="color: #006633;">BID</span>,<span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">long</span> nextToLastBarTime <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_MIN</span>, OfferSide.<span style="color: #006633;">BID</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stddev <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stdDev</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, timePeriod, nbDev, nextToLastBarTime, lastBarTime<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>To get <i>stddev</i> indicator values for previous candle specifying bar start time <i>askBar.getTime()</i> and candle count before this bar <i>candlesBefore</i> and after <i>candlesAfter</i>: <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stddev <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stdDev</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">ASK</span>, AppliedPrice.<span style="color: #006633;">CLOSE</span>, timePeriod, nbDev,<br />&nbsp; &nbsp;Filter.<span style="color: #006633;">NO_FILTER</span>, candlesBefore, askBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candlesAfter<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The last example shows how to get last bar <i>stddev</i> indicator values using universal method: <br/><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stddev <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;STDDEV&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>AppliedPrice.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <br />&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>timePeriod, nbDev<span style="color: #009900;">&#125;</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">double</span> result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Double</span><span style="color: #009900;">&#41;</span> stddev<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><span id="Indicator_catalog/Stochastic"><h1>Stochastic</h1></span>The stochastics indicator shows instrument overbought and oversold in the market. When two stochastics lines are above 80, then it means that the instrument is overbought and when two stochastics lines are below 20, it means that the instrument is oversold.<br/><img src="https://www.dukascopy.com/wiki/files//indicator_catalog_14.jpg" border="0" /><br/>First we need to initialize necessary fields(periods and moving average types)<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">int</span> fastKPeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">int</span> slowKPeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span><br />MaType slowKMaType <span style="color: #339933;">=</span> MaType.<span style="color: #006633;">SMA</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">int</span> slowDPeriod <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span><br />MaType slowDMaType <span style="color: #339933;">=</span> MaType.<span style="color: #006633;">SMA</span><span style="color: #339933;">;</span></div><br/>To get stochastics indicator values for previous candle specifying shift:<br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stoch <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stoch</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, fastKPeriod, slowKPeriod, slowKMaType, slowDPeriod, slowDMaType, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns array of double containing 2 values: <b>stoch[0]</b> - slow % K value and <b>stoch[1]</b> - slow %D value. <br/><br/>To get stochastics indicator values for previous candle using time range: <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stoch <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stoch</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, fastKPeriod, slowKPeriod, slowKMaType, slowDPeriod, slowDMaType, <br />prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns array of double arrays containing 2 values: <b>stoch[0][0]</b> - slow % K value; <b>stoch[1][0]</b> - slow %D value.<br/><br/>To get stochastics values for 2 previous bars, from and to bar time must be changed and then passed to the <i>stoch</i> method: <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">long</span> lastBarTime <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_MIN</span>, OfferSide.<span style="color: #006633;">BID</span>,<span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">long</span> nextToLastBarTime <span style="color: #339933;">=</span> history.<span style="color: #006633;">getBar</span><span style="color: #009900;">&#40;</span>instrument, Period.<span style="color: #006633;">ONE_MIN</span>, OfferSide.<span style="color: #006633;">BID</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br /><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stoch <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stoch</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, fastKPeriod, slowKPeriod, slowKMaType, slowDPeriod, slowDMaType, &nbsp;nextToLastBarTime, lastBarTime<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>This example returns array of double arrays containing 4 values: <br/><ul><li>stoch[0][1] - last candle slow % K value.</li><li>stoch[1][1] - last candle slow %D value.</li><li>stoch[0][0] - next-to-last candle slow % K value.</li><li>stoch[1][0] - next-to-last candle slow %D value.</li></ul><br/>To get stochastics indicator values for previous candle specifying bar start time<i>\u0412 prevBar.getTime()</i>\u0412 and candle count before this bar <i>candlesBefore</i>\u0412 and after\u0412 <i>candleAfter</i>: <br/><div class="dw_article_geshi_code"><span style="color: #000066; font-weight: bold;">double</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stoch <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">stoch</span><span style="color: #009900;">&#40;</span>instrument, period, OfferSide.<span style="color: #006633;">BID</span>, fastKPeriod, slowKPeriod, slowKMaType, slowDPeriod, slowDMaType, <br />&nbsp; &nbsp; &nbsp; Filter.<span style="color: #006633;">NO_FILTER</span>, candlesBefore, prevBar.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, candlesAfter <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>The example above returns array of double arrays containing 2 values.<br/><br/>The last example shows how to get last bar stochastics indicator values using universal method: <br/><div class="dw_article_geshi_code"><span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> stochUniversal <span style="color: #339933;">=</span> indicators.<span style="color: #006633;">calculateIndicator</span><span style="color: #009900;">&#40;</span>instrument, period, <span style="color: #000000; font-weight: bold;">new</span> &nbsp;OfferSide<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>OfferSide.<span style="color: #006633;">BID</span><span style="color: #009900;">&#125;</span>, <span style="color: #0000ff;">&quot;STOCH&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> IIndicators.<span style="color: #006633;">AppliedPrice</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span>AppliedPrice.<span style="color: #006633;">CLOSE</span><span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span>fastKPeriod, slowKPeriod, slowKMaType.<span style="color: #006633;">ordinal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, slowDPeriod, slowDMaType.<span style="color: #006633;">ordinal</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>, shift<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div>Please see the <a href="#Strategy_API:_Indicators">Indicator usage</a> for more details about indicators methods parameters.<br/><br/>